export default defineNuxtConfig({
  hooks: {
    close: (nuxt) => {
      if (!nuxt.options._prepare)
        process.exit()
    }
  },
  devtools: { enabled: true },
  modules: [
    '@nuxtjs/tailwindcss',
    '@nuxtjs/seo',
    '@pinia/nuxt',
  ],
  css: ['~/assets/css/main.css'],
  runtimeConfig: {
    public: {
      siteUrl: process.env.NUXT_PUBLIC_SITE_URL || 'https://localhost:3000',
      siteName: '八八在线工具',
      siteDescription: '在线工具集合 - 文本处理、图片编辑、编码转换等多种实用工具',
      language: 'zh-CN',
    }
  },
  app: {
    head: {
      charset: 'utf-8',
      viewport: 'width=device-width, initial-scale=1',
      title: '八八在线工具 - 在线工具集合',
      meta: [
        { name: 'description', content: '在线工具集合，提供文本处理、图片编辑、编码转换、二维码生成、紫薇斗数、八字排盘等多种实用工具' },
        { name: 'keywords', content: '在线工具,工具,文本处理,图片编辑,二维码,编码转换,紫薇斗数,八字排盘' },
        { name: 'author', content: 'Free Tools Team' },
        { property: 'og:title', content: '八八在线工具 - 在线工具集合' },
        { property: 'og:description', content: '在线工具集合，提供文本处理、图片编辑、编码转换、二维码生成、紫薇斗数、八字排盘等多种实用工具' },
        { property: 'og:type', content: 'website' },
        { name: 'twitter:card', content: 'summary_large_image' },
        { name: 'twitter:title', content: '八八在线工具 - 在线工具集合' },
        { name: 'twitter:description', content: '在线工具集合，提供文本处理、图片编辑、编码转换、二维码生成、紫薇斗数、八字排盘等多种实用工具' }
      ],
      link: [
        { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
        { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
  { rel: 'apple-touch-icon', sizes: '180x180', href: '/favicon.svg' },
        { rel: 'manifest', href: '/site.webmanifest' },
        { rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#2563EB' }
      ]
      ,
      // No es-module-shims: we don't need importmap/module-shim support for old browsers.
      // Keep scripts empty to avoid loading third-party scripts that may trigger
      // Tracking Prevention storage access warnings in some browsers.
      script: []
    }
  },
  // No hooks needed for module-shim replacement since we don't use es-module-shims.
  nitro: {
    prerender: {
      routes: ['/sitemap.xml']
    }
  }
})